def convert(s,numRows):
    s_len=len(s)
    r=0
    flag=1
    res=["" for _ in range(numRows)]
    for i in range(s_len):
        res[r]+=s[i]
        r+=flag
        if r==0 or r==numRows-1:
            flag=-flag
    s_conv=""
    for i in range(numRows):
        s_conv+=res[i]
    return s_conv
s="PAYPALISHIRING"
numRows=3
print(convert(s,numRows))